﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
using System.Data.Entity.Infrastructure;
using DLM.Domain.Model;

namespace DLM.Data.EF.CodeFirst.Mapping
{
    public class InvitationMap:EntityTypeConfiguration<Invitation>
    {
        public InvitationMap()
        {
            this.HasKey(t => t.InvitationID);
            this.ToTable("Invitation");
            this.Property(t => t.InvitationID).HasColumnName("InvitationID");
            this.Property(t => t.UserID).HasColumnName("UserID");
            this.Property(t => t.PartyID).HasColumnName("PartyID");
            this.Property(t => t.IsConfirmed).HasColumnName("IsConfirmed");
            this.Property(t => t.InviteDate).HasColumnName("InviteDate");
            this.Property(t => t.SenderID).HasColumnName("SenderID");
            this.Property(t => t.SenderAccount).HasColumnName("SenderAccount").HasMaxLength(25);
            this.HasRequired(t => t.User).WithMany(t => t.Invitation).HasForeignKey(d => d.UserID);
        }
    }
}
